<?php
defined('_JEXEC') or die('Direct Access to this location is not allowed.'); 
class Modprop_cat_typeHelper 
{
    function getItems()
    {
	global $mainframe, $option;   
	jimport('joomla.application.component.helper');
	$db = &JFactory::getDBO();

        $query = 'SELECT c.*, '
				. ' CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(":", c.id, c.alias) ELSE c.id END as slug'
                . ' FROM #__properties_category as c '
				. ' WHERE c.published = 1 '
				. ' ORDER BY c.ordering'
				;										
        $db->setQuery($query);
		//$items = $db->loadObjectList();		
        $items = ($items = $db->loadObjectList())?$items:array(); 
        return $items;
    }
	
	
function getTypes ()
	    {
	global $mainframe, $option;   
	jimport('joomla.application.component.helper');
	$db = &JFactory::getDBO();

        $query = 'SELECT t.*, '
				. ' CASE WHEN CHAR_LENGTH(t.alias) THEN CONCAT_WS(":", t.id, t.alias) ELSE t.id END as Tslug'
                . ' FROM #__properties_type as t '
				. ' WHERE t.published = 1 '
				. ' ORDER BY t.ordering'
				;										
        $db->setQuery($query);
		//$items = $db->loadObjectList();		
        $items = ($items = $db->loadObjectList())?$items:array(); 
        return $items;
    }
	
} 


	